using Senparc.Weixin.MP.Entities.GoogleMap;
using System;
using System.Collections.Generic;
using System.Text;
namespace Senparc.Weixin.MP.Helpers
{
	public static class GoogleMapHelper
	{
		public static string GetGoogleStaticMap(int scale, IList<GoogleMapMarkers> markersList, string size = "640x640")
		{
			markersList = (markersList ?? new List<GoogleMapMarkers>());
			StringBuilder stringBuilder = new StringBuilder();
			foreach (GoogleMapMarkers current in markersList)
			{
				stringBuilder.Append("&markers=");
				if (current.Size != GoogleMapMarkerSize.Default)
				{
					stringBuilder.AppendFormat("size={0}%7C", current.Size);
				}
				if (!string.IsNullOrEmpty(current.Color))
				{
					stringBuilder.AppendFormat("color:{0}%7C", current.Color);
				}
				stringBuilder.Append("label:");
				if (!string.IsNullOrEmpty(current.Label))
				{
					stringBuilder.AppendFormat("{0}%7C", current.Label);
				}
				stringBuilder.AppendFormat("{0},{1}", current.X, current.Y);
			}
			string str = string.Format("center=&zoom=&size={0}&maptype=roadmap&format=jpg&sensor=false&language=zh&{1}", size, stringBuilder.ToString());
			return "http://maps.googleapis.com/maps/api/staticmap?" + str;
		}
	}
}
